Please feel free to start with MWE as an example of use of the code.

This code needs the following files to execute properly:

test_im1.mat
test_im2.mat
test_masks.mat